<template>

  <div>

    <div style="height: 100px;margin-top: 0px ">
      <div style="float: left;width: 70%;height: 100%">
        <p style="color: black;font-size: 23px;line-height: 23px;font-weight: bold;height: 40px;margin-left: 40%">--  完成过的项目展示  --</p>
      </div>
      <div style="float: left;width: 30%;height: 100%">
        <el-button  type="success" style="margin-bottom: 20px" round @click="jump('AppendFinshWorkHh')">添加项目</el-button>
      </div>
    </div>

    <div v-for="table in tableData" :key="table.projectname" style="float: left;margin-left: 85px;height: 500px;width: 400px ;background-color: white;margin-top: 50px;box-shadow: 0 8px 4px rgba(0, 0, 0, .12), 0 0 6px rgba(0, 0, 0, .04)" >
      <div  style="width: 300px;height: 200px;margin-top: 10px">
        <img :src="table.photo" style="width: 250px;height: 200px;margin-left: 70px">
      </div>
      <div style="height: 120px;width: 300px;line-height: 0px">
        <div  class="text-wrapper" style="height: 30px;width: 400px">
          <p>项目名：{{table.projectname}}</p>
        </div>
        <div  class="text-wrapper" style="height: 30px;width: 400px">
          <p >项目属性：{{table.lable}}</p>
        </div>
        <div  class="text-wrapper" style="height: 30px;width: 400px">
          <p style="size: A5;text-align: center;">用时：{{table.usetime}}</p>
        </div>
        <div  class="text-wrapper" style="height: 30px;width: 400px">
          <p style="size: A5;text-align: center;">价格：{{table.price}}</p>
        </div>
      </div>
      <div class="text-wrapper" style="width: 300px;height:150px;white-space: pre-wrap;margin-top: 30px" >
        <div style="height: 130px;line-height: 0px ;margin-left: 40px">
          <p style="width: 300px;word-wrap: break-word;height: 130px;line-height: 30px ;margin-top: 30px;overflow: auto">简介： {{table.introduce}}  <a :href=table.doc >点我下载详细信息</a></p>
        </div>
      </div>
    </div>
  </div>


</template>

<script>
  export default {
    data() {
      return {
        tableData: [
          { usetime:'',
            projectname:'',
            photo:'',
            lable:'',
            introduce:'',
            doc:'',
            price:''
          }
        ]
      }
    },
    mounted: function(){
      var user= JSON.parse(window.sessionStorage.getItem("user"));
      var ff=user.id
      axios.post('/workroom/lookProject',{
        id : ff,
        idd:ff
      }).then((response) => {
        if( response.data != null){
          this.$notify({
            title: '成功',
            message: '成功',
            type: 'success',
            duration:2000
          });
          var e=response.data.user
          console.log(e)
          var data=[];

          for(var c=0;c<e.length;c++){

            var ee=e[c];
            var obj={}
            obj.lable=ee.lable
            obj.usetime=ee.usetime
            obj.projectname=ee.projectname
            obj.price=ee.price
            obj.photo=ee.photo
            obj.introduce=ee.introduction
            obj.doc=ee.doc
            data[c]=obj
            console.log(obj)
          }
          this. tableData=data


        }
        else{
          this.$notify({
            title: '失败',
            message: '错误',
            type: 'warning',
            duration:2000
          });
        }
      })

    },
    methods: {

      jump(path){
        this.$router.replace({path:path})
      },


      handleEdit(index, row) {
        console.log(row.id)
        var ff=row.id


        axios.post('/admin/acceptWorkroomApply',{
          id : ff,
          idd  : ff
        }).then((response) => {
          if( response.data.states== 800){
            this.$notify({
              title: '成功',
              message: '成功',
              type: 'success',
              duration:2000

            });

            location.reload()
          } else{
            this.$notify({
              title: '失败',
              message: '错误',
              type: 'warning',
              duration:2000
            });
          }
        })


      },
      handleDelete(index, row) {
        console.log(index, row);
        var ff=row.id
        axios.post('/admin/refuseWorkroomApply',{
          id : ff,
          idd  : ff
        }).then((response) => {
          if( response.data.states== 800){
            this.$notify({
              title: '成功',
              message: '成功',
              type: 'success',
              duration:2000
            });
            location.reload()
          }
          else{
            this.$notify({
              title: '失败',
              message: '错误',
              type: 'warning',
              duration:2000
            });
          }
        })


      }

    }}
</script>



<style scoped>

</style>
